 <template>
 	<el-dialog title="" visible :show-close="false" :modal-append-to-body="false" class="wrap">
 		<div class="bt">详情</div>
		<i class="el-icon-close close" @click="cancel" style="color: white;z-index:10;"></i>
 		<el-form label-width="100px" class="form">
 		 <div class="left">
 			<el-form-item label="中文名">
 				<el-input v-model="form.zwm" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="英文名">
 				<el-input v-model="form.ywm" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="性别">
 				<el-input v-model="form.xb" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="电话">
 				<el-input v-model="form.dh" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<!-- <el-form-item label="是否启用">
 				<el-input v-model="form.isqymc" :readonly='true'  class="select-block"></el-input>
 			</el-form-item> -->
 			<el-form-item label="出生日期">
 				<el-input v-model="form.csrq" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="招生来源">
 				<el-input v-model="form.zsly" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 		</div>

 		<div class="right">
 			<el-form-item label="父母电话">
 				<el-input v-model="form.fmdh" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="微信号">
 				<el-input v-model="form.wx" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="家庭地址">
 				<el-input v-model="form.jtdz" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="公立学校">
 				<el-input v-model="form.glxx" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="年级班级">
 				<el-input v-model="form.njmc" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			<!-- <el-form-item label="学号">
 				<el-input v-model="form.xh" :readonly='true'  class="select-block"></el-input>
 			</el-form-item> -->
 			<el-form-item label="账号余额">
 				<el-input v-model="form.yuer" :readonly='true'  class="select-block"></el-input>
 			</el-form-item>
 			
 		</div>
 			<el-form-item label="学生标签" >
 				<el-tag style="float: left;" type="success" :readonly='true' v-for="(v,index) in bqList">
 						{{v}}
 				<!--<i class="el-icon-close del1" @click = "delbq(v)"></i>-->
 				</el-tag>
 				
 			</el-form-item>
 		</el-form>
 		<el-button type="primary" class="submit" @click="submit">确定</el-button>
 	</el-dialog>
 </template>
 <script type="text/javascript">
 	import qs from 'qs'
 	export default {
 		props: ['params'],
 		data() {
 			return {
 				bqList:[],
 				form: {
					 dh :'',
					 mm :'',
					 tx :'',
					 xb :'',
					 zwm :'',
					 ywm :'',
					 lsid :'',
					 bjid :'',
					 isty :'',
					 iszf :'',
					 issj :'',
					 isqymc:'',
					 lx :'',
					 csrq :'',
					 zsly :'',
					 fmdh :'',
					 wx :'',
					 jtdz :'',
					 glxx :'',
					 njbj :'',
					 bj :'',
					 xh :'',
					 yuer :'',
 					 id:''
 				}
 			}
 		},
 		created() {
  		 this.form.id = this.params.row.id;
          this.loadinfo();
 		},
 		methods: {
// 			delbq(bq){   
// 				var dd =[];
// 				  for ( let i in this.bqList ) {
// 				  	if (this.bqList[i]==bq){
// 				  		continue}else{
// 				  		 dd.push(this.bqList[i]);
// 				  	}
// 				  }
// 				  this.bqList= dd;
//           },
 			loadinfo(){
 				 var logininfo = JSON.parse(localStorage.logininfo) ;
 				 this.axios.get(this.$store.state.api+'xs/info',{
 						 params:{
 							 xxid:logininfo.xxid,
 							 yhid:logininfo.id,
 							 id:this.form.id
 						 }
 					}).then( res =>  {
 							this.form=res.data.data
 							try{
 							this.bqList = this.form.bq.split(',');
 							}catch(e){}
 					 }).catch(res => {
 						 this.$message.warning("服务器异常");
 			 				this.$emit('close', { type: 'info', cancel: true });
 					 })
 			},
 			 submit() {
 				//检测
 				this.$store.state.loading = true;
 				/*if(!this.form.id) {
 					this.$message.warning('请填写分类');
 					this.$store.state.loading = false;
 					return;
 				}*/
 				//装载数据
 				var logininfo = JSON.parse(localStorage.logininfo);
 				var params2 = qs.stringify({
 						id: this.form.id,
 						yhid: logininfo.id,
 						xxid: logininfo.xxid
 					})
 				//执行
 				    this.axios.post(this.$store.state.api + 'xs/info',  params2 )
 						.then(res => {
 							if(res.data.code == 1) {
 								this.$emit('close', { type: 'info', cancel: false });
 								this.$store.state.loading = false;
 							} else {
 								this.$emit('close', { type: 'info', cancel: false });
 								this.$store.state.loading = false;
 							}
 						}).catch(res => {
 							this.$message.warning("服务器异常");
 							this.$store.state.loading = false;
 						})
 			},
 			cancel() {
 				this.$emit('close', { type: 'info', cancel: true })
 			}
 		}
 	}
 </script>
 <style lang="less" scoped>
 	.wrap {
 		text-align: center;
 	}
 	.form {
 		text-align: left;
 		margin-top: 20px;
 	}
 	.bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top:0;
			left:0;
			background: #50BFFF;
			margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
 	.input {
             width: 300px;
             display: inline-block;
         }
 	.select-block {
 		display: block;
 	}
 	.submit {
 		width: 120px;
 	}
 	.left{
 		width: 50%;
 		height: 100%;
 		float: left;
 	}
 	.right{
 		width: 50%;
 		height: 100%;
 		float: right;
 	}
 </style>
